export const exportToCSV = (data) => {
    const csvContent = data
      .map(row => 
        row.map(cell => 
          `"${cell.toString().replace(/"/g, '""')}"`
        ).join(',')
      ).join('\n')
  
    const blob = new Blob([csvContent], { type: 'text/csv;charset=utf-8;' })
    const link = document.createElement('a')
    const url = URL.createObjectURL(blob)
    
    link.setAttribute('href', url)
    link.setAttribute('download', 'spreadsheet.csv')
    link.style.visibility = 'hidden'
    document.body.appendChild(link)
    link.click()
    document.body.removeChild(link)
  }